﻿using Common.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wallpaper.Models.Interfaces;

namespace Wallpaper.Models.Entities
{
    public class Menu : BaseEntity, IHasTimestamps,ISoftDelete
    {

        /// <summary>
        /// 菜单名称（对应前端的 title 字段）
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 路由路径（对应前端的 path 字段）
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// 菜单图标（对应前端的 icon 字段）
        /// </summary>
        public string Icon { get; set; }

        /// <summary>
        /// 组件路径
        /// </summary>
        public string? Component { get; set; }

        /// <summary>
        /// 排序号（数字越小越靠前）
        /// </summary>
        public int Sort { get; set; }


        public int Type { get; set; }

        /// <summary>
        /// 父级菜单ID（对应前端的 children 关系）
        /// </summary>
        public string? ParentId { get; set; }

        /// <summary>
        /// 启用状态：true-启用，false-禁用
        /// </summary>
        public bool IsEnabled { get; set; } = true;

        /// <summary>
        /// 软删除标志：true-已删除，false-正常
        /// </summary>
        public bool IsDeleted { get; set; }


        public DateTime CreatedAt { get; set; }

        public DateTime? UpdatedAt { get; set; }

        // 导航属性
        public virtual Menu Parent { get; set; }
        public virtual ICollection<Menu> Children { get; set; } = new List<Menu>();
        public virtual ICollection<RoleMenu> RoleMenus { get; set; } = new List<RoleMenu>();
        public virtual ICollection<Permission> Permissions { get; set; } = new List<Permission>();
    }
}
